chores: refactor internal build to call peg via "go tool"#192
Merged
Conversation
go get -tool . About tools, see https://go.dev/doc/modules/gomod-ref#tool
Now that that 'peg' itself is registered as a tool in go.mod we can call it directly via 'go tool peg' in '//go:generate' lines (in grammars): peg will be automatically built (and cached) as necessary.
* Simplify generate-grammars.bash using Go package patterns. * Forward flags to 'go generate' Example: $ ./generate-grammars.bash -n go tool peg -switch -inline c.peg go tool peg -switch -inline calculator.peg go tool peg -switch -inline calculator.peg go tool peg -switch -inline fexl.peg go tool peg -switch -inline java_1_7.peg go tool peg -switch -inline long.peg
Use 'go tool peg' (instead of 'go build && ./peg') to run peg for regenerating peg.peg.go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pegas a tool:go get -tool .//go:generatelines ingrammars/, andgenerate-grammars.bash,bootstrap.bashto now executepegviago tool pegBenefits:
pegtool viago toolensures a fresh build from the latest local sourcespegwith a modern toolchain (go1.24+)